//重写匹配地址:core-c-hl.amemv.com/aweme/v1/aweme/post
//QuanX重写配置:core-c-hl.amemv.com/aweme/v1/aweme/post url script-response-body https://gitee.com/passerby-b/javascript/raw/master/dywm.js
//MITM:*.amemv.com
//需要到作者的作品列表里找到那个视频再下载
var body = $response.body;
try {
  if ($request.url.indexOf(".amemv.com/aweme/v1/aweme/post") > -1 && !!body) {
    console.log("🍎抖音去水印脚本开始!");
    var obj = JSON.parse(body);
    //console.log("🍎服务器返回Body内容:" + body);
    for (var i = 0; i < obj.aweme_list.length; i++) {
      var play_addr = obj.aweme_list[i].video.play_addr.url_list;
      obj.aweme_list[i].video.download_addr.url_list = play_addr;
      if (!!obj.aweme_list[i].video.download_suffix_logo_addr.url_list) {
        obj.aweme_list[i].video.download_suffix_logo_addr.url_list = play_addr;
      }
      console.log("🍎播放地址:" + play_addr);
    }
    var newBody = JSON.stringify(obj);
    console.log("🍎修改后Body内容:" + newBody);
    $done({
      body: newBody
    })
  } else {
    console.log("🍎🍎body为空");
    $done({})
  }
} catch (e) {
  console.log("🍎🍎🍎🍎try错误:" + e);
  $done({})
}
console.log("🍎抖音去水印脚本执行完成!!!!");